package com.sh.threadmethod.threadpriority;

/**
 * @Auther: sh
 * @Version 1.0
 * @Description:
 */
public class PriorityThread implements Runnable {


    @Override
    public void run() {
        System.out.println("优先级为：" + Thread.currentThread().getPriority());
    }

    public static void main(String[] args) {
        PriorityThread priorityThread = new PriorityThread();
        Thread thread1 = new Thread(priorityThread);
        thread1.setPriority(8);

        Thread thread2 = new Thread(priorityThread);
        thread2.setPriority(6);

        Thread thread3 = new Thread(priorityThread);
        thread3.setPriority(4);

        Thread thread4 = new Thread(priorityThread);
        thread4.setPriority(2);

        Thread thread5 = new Thread(priorityThread);
        thread5.setPriority(1);







        thread1.start();
        thread2.start();
        thread3.start();
        thread4.start();
        thread5.start();
    }
}

